package com.zf.zfed.audit.tools.extension

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer

fun <T: Any, L: LiveData<T?>> AppCompatActivity.observe(liveData: L, body: (T?) -> Unit) = liveData.observe(this, Observer(body))

fun <T: Any, L: LiveData<T?>> Fragment.observe(liveData: L, body: (T?) -> Unit) = liveData.observe(viewLifecycleOwner, Observer(body))